package com.baomidou.springwind.pojo;


import com.baomidou.springwind.entity.NetworkDelivery;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 备选配送中心
 *
 * @Author demo
 * @Date 2017-8-22
 */
public class SiteSelection {

    private boolean older;
    private String name;
    private BigDecimal coordinateX;

    private BigDecimal coordinateY;

    private BigDecimal order;
    private Long lnglatId;

    private List<SiteSelection> children;

    public SiteSelection() {
    }

    public SiteSelection(String name, BigDecimal coordinateX, BigDecimal coordinateY, BigDecimal order,Long lnglatId) {
        this.name = name;
        this.coordinateX = coordinateX;
        this.coordinateY = coordinateY;
        this.order = order;
        this.lnglatId = lnglatId;
    }

    public static SiteSelection transform(NetworkDelivery delivery) {
        SiteSelection ss = new SiteSelection();
        ss.name = delivery.getName();
        ss.coordinateX = delivery.getCoordinateX();
        ss.coordinateY = delivery.getCoordinateY();
        ss.order = delivery.getOrderQuantity();
        ss.lnglatId= delivery.getLnglatId();
        return ss;
    }

    public static NetworkDelivery transform(SiteSelection ss) {
        NetworkDelivery delivery = new NetworkDelivery();
        delivery.setName(ss.name);
        delivery.setCoordinateX(ss.coordinateX);
        delivery.setCoordinateY(ss.coordinateY);
        delivery.setOrderQuantity(ss.order);
        delivery.setLnglatId(ss.lnglatId);
        return delivery;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getCoordinateX() {
        return coordinateX;
    }

    public void setCoordinateX(BigDecimal coordinateX) {
        this.coordinateX = coordinateX;
    }

    public BigDecimal getCoordinateY() {
        return coordinateY;
    }

    public void setCoordinateY(BigDecimal coordinateY) {
        this.coordinateY = coordinateY;
    }

    public BigDecimal getOrder() {
        return order;
    }

    public void setOrder(BigDecimal order) {
        this.order = order;
    }

    public boolean isOlder() {
        return older;
    }

    public void setOlder(boolean older) {
        this.older = older;
    }

    public List<SiteSelection> getChildren() {
        return children;
    }

    public Long getLnglatId() {
        return lnglatId;
    }

    public void setLnglatId(Long lnglatId) {
        this.lnglatId = lnglatId;
    }

    public void setChildren(List<SiteSelection> children) {
        this.children = children;
    }

    public void addAllChildren(List<SiteSelection> children) {
        if (this.children == null) {
            this.children = new ArrayList<SiteSelection>();
        }
        this.children.addAll(children);
    }

    @Override
    public String toString() {
        return "SiteSelection{" +
                "name='" + name + '\'' +
                ", coordinateX=" + coordinateX +
                ", coordinateY=" + coordinateY +
                ", order=" + order +
                ", children=" + children +
                '}';
    }
}
